package com.googlecode.cswish.struts.spring;

import java.lang.reflect.Method;

/** 
 * Object factory interface
 * 
 * @author Jerry.feng Date: 10/09/2008
 */
public interface IFactory {

	/**
	 * Create a method to a new POJO Class.
	 * 
	 * <p> method parameter + return value ==> the object properties<br>
	 * method body is the default method body<br>
	 * return type of method is 'void'<br>
	 * return value of the new POJO object is passed by the properties<br>
	 * 
	 * @param method
	 * @return
	 */
	public Class<?> create(Method method);
	
	
	public Class<?> create(Method method, String className, Class<?> superClass, Class<?> returnType);
	
	/**
	 * add a new method to old class, use a new class loader to load current class
	 * 
	 * How to call the new method if the parameter is not matched?
	 * 
	 * @param clazz
	 * @param methodName
	 * @param method
	 * @return
	 */
	public Class<?> add(Class<?> clazz, String methodName, Method method);
	
	/**
	 * 
	 * 
	 * @param oldMethod
	 * @param wrapper
	 * @return
	 */
	public Class<?> intercept(Method oldMethod, Class<?> interceptor);
	
	/**
	 * Remove the existed method from current class
	 * 
	 * @param method
	 * @return
	 */
	public Class<?> delete(Method oldMethod);
}